# Usage with Vitis IDE:
# In Vitis IDE create a Single Application Debug launch configuration,
# change the debug type to 'Attach to running target' and provide this 
# tcl script in 'Execute Script' option.
# Path of this script: D:\gw50-work\GU203\new_gu203\test_system\_ide\scripts\debugger_test-default.tcl
# 
# 
# Usage with xsct:
# To debug using xsct, launch xsct and run below command
# source D:\gw50-work\GU203\new_gu203\test_system\_ide\scripts\debugger_test-default.tcl
# 
connect -url tcp:127.0.0.1:3121
targets -set -filter {jtag_cable_name =~ "Digilent JTAG-SMT2 21025DA09819" && level==0 && jtag_device_ctx=="jsn-JTAG-SMT2-21025DA09819-04b49093-0"}
fpga -file D:/gw50-work/GU203/gw/latest/0124/bitfile/gu203_top.bit
targets -set -nocase -filter {name =~ "*microblaze*#0" && bscan=="USER2" }
loadhw -hw D:/gw50-work/GU203/new_gu203/new_gu203/export/new_gu203/hw/gu203_top.xsa -regs
configparams mdm-detect-bscan-mask 2
targets -set -nocase -filter {name =~ "*microblaze*#0" && bscan=="USER2" }
rst -system
after 3000
targets -set -nocase -filter {name =~ "*microblaze*#0" && bscan=="USER2" }
dow D:/gw50-work/GU203/new_gu203/test/Debug/test.elf
bpadd -addr &main
